package com.xqq.enums;

public enum PlaceEnum {
    START_POINT(1, "起始点"),
    SAFE_SPACE(2, "空地避险点"),
    VILLAGE_TOWN(3, "村镇"),
    INTERSECTION(4, "路口"),
    BRIDGE(5, "大桥"),
    ALONG_LINE_BRIDGE(6, "沿线桥梁"),
    GAS_STATION(7, "加油站"),
    HOSPITAL(8, "医院"),
    POLICE_STATION(9, "警察局"),
    MILITARY_FACILITY(10, "军事设施"),
    GATHERING_POINT(11, "汇集点"),
    PARKING_POINT(12, "停车点"),
    EMPTY_LAND(13, "空地"),
    PAGODA(14, "宝塔"),
    CHURCH(15, "教堂"),
    TEMPLE(16, "寺庙"),
    RESTAURANT(17, "饭馆"),
    SCHOOL(18, "学校"),
    AUTO_PARTS_STORE(19, "汽车零配件"),
    AUTO_REPAIR(20, "汽车维修"),
    CHECKPOINT(21, "检查站"),
    DIFFICULT_ROAD(22, "路面难行"),
    INSPECTION_POINT(23, "检查点");

    private final int code;
    private final String description;

    PlaceEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static PlaceEnum fromCode(int code) {
        for (PlaceEnum place : PlaceEnum.values()) {
            if (place.getCode() == code) {
                return place;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}
